Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent potential UB by deriving repr C for union #4296

Merged
merged 1 commit into from
Nov 7, 2023

Conversation

0xalpharush
Copy link
Contributor

@0xalpharush 0xalpharush commented Nov 6, 2023

Description

Use repr C for VMFunctionContext to prevent undefined behavior. I believe this union may exhibit UB since it crosses an FFI boundary. Also, I think eq and is_null may be called on both instances of the union despite the layout not being guaranteed. This is explained further this by this clippy lint so perhaps it's worth configuring it to be deny.

@syrusakbary
Copy link
Member

Looks great, thanks!

@syrusakbary syrusakbary merged commit fda7efe into wasmerio:master Nov 7, 2023
53 checks passed
@0xalpharush 0xalpharush deleted the fix/repr-c-union branch November 7, 2023 03:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants